package com.herongo.service.impl;

import com.herongo.dao.IUserDao;
import com.herongo.entity.*;
import com.herongo.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class UserServiceImpl implements IUserService {
    @Autowired
    private IUserDao userDao;
    /**
     * 修改商品详情图
     * @param goodDetailmg
     * @return
     */
    @Override
    public boolean modifyDetaimg(GoodDetailmg goodDetailmg) {
        return userDao.modifyDetaimg(goodDetailmg);
    }

    /**
     * 修改商品详情内容
     * @param goodDetailContent
     * @return
     */
    @Override
    public boolean modifyDetailContent(GoodDetailContent goodDetailContent) {
        return userDao.modifyDetailContent(goodDetailContent);
    }





    /**
     * 修改商品轮播图
     * @param goodHeadImg
     * @return
     */
    @Override
    public boolean modifyDetaiHeImg(GoodHeadImg goodHeadImg) {
        return userDao.modifyDetaiHeImg(goodHeadImg);
    }

    /**
     * 通过 id 查找商品详情图
     * @param gooId
     * @return
     */


//    public Good queryGoodDetail(Integer gooId) {
//
//        // h获得 商品
//        //  List<GoodDetailmg> goodDetailmgList = userDao.queryImg(gooId);
////        List<GoodDetailContent> goodDetailContentList =userDao.queryContent(gooId);
////        List<GoodHeadImg> goodHeadImgList = userDao.queryGoodHeadImg(gooId);
//        // good.set
//
//    }
//


    @Override
    public List<GoodDetailmg> queryImg(Integer gooId) {
        List<GoodDetailmg> goodDetailmgList = userDao.queryImg(gooId);
        return goodDetailmgList;
    }
    /**
     * 通过 商品id 查找商品详情内容
     * @param gooId
     * @return
     */
    @Override
    public List<GoodDetailContent> queryContent(Integer gooId) {
        List<GoodDetailContent> goodDetailContentList =userDao.queryContent(gooId);

        return goodDetailContentList;
    }
    /**
     * 通过 商品id 查找商品轮播图
     * @param gooId
     * @return
     */
    @Override
    public List<GoodHeadImg> queryGoodHeadImg(Integer gooId) {
        List<GoodHeadImg> goodHeadImgList = userDao.queryGoodHeadImg(gooId);

        return goodHeadImgList;
    }
    /**
     * 通过 id 查找全部评论
     * @param goodId
     * @return
     */
    @Override
    public List<GoodComment> queryCommentList(Integer goodId) {
        return  userDao.queryCommentList(goodId);
    }
    /**
     * 添加评论
     * @param comment
     * @return
     */
    @Override
    public boolean addComment(GoodComment comment) {
        return userDao.addComment(comment);
    }


}